import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

// This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        appBar: AppBar(title: const Text("FLutter App")),
        body: const LayoutDemo(),
      ),
    );
  }
}

class LayoutDemo extends StatelessWidget {
  const LayoutDemo({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.all(10),

      child: ListView(
        children: [
          Row(
            children: [
              Text("热搜",style: Theme.of(context).textTheme.headline6,)
            ],
          ),
          const Divider(),
          Wrap(
            spacing: 10,
            runSpacing: 12,
            children: [
              Button("女装", onPressed: () {}),
              Button("笔记本", onPressed: () {}),
              Button("玩具", onPressed: () {}),
              Button("文学", onPressed: () {}),
              Button("女装", onPressed: () {}),
              Button("时尚", onPressed: () {}),
              Button("女装", onPressed: () {}),
              Button("女装", onPressed: () {}),
            ],
          ),
          const SizedBox(height: 10,),
          Row(
            children: [
              Text("历史记录",style: Theme.of(context).textTheme.headline6,)
            ],
          ),
          const Divider(),
          Column(
            children:  [
              ListTile(
                leading: Image.asset("images/1.png"),
                title: const Text("女装"),
              ),
              const Divider(),
              const ListTile(
                title:  Text("时尚"),
              ),
              const Divider(),
            ],
          ),
          const SizedBox(height: 40,),
          Padding(
            padding: const EdgeInsets.all(20),
            child: OutlinedButton.icon(
                onPressed: () {},
                style: ButtonStyle(
                    foregroundColor: MaterialStateProperty.all(Colors.black38)),
                icon: const Icon(Icons.delete),
                label: const Text("清空历史记录")),
          )
        ],
      ),

    );
  }
}


class Button extends StatelessWidget {
  String text;
  void Function()? onPressed;

  Button(this.text, {Key? key, required this.onPressed}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return ElevatedButton(
      onPressed: onPressed,
      style: ButtonStyle(
        backgroundColor:
        MaterialStateProperty.all(const Color.fromARGB(255, 236, 233, 233)), foregroundColor: MaterialStateProperty.all(Colors.black45),
      ),
      child: Text(text),
    );
  }
}

